/*
	Ancient Control Screen for GarrysMod10
	Copyright (C) 2007 RononDex

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

// Includes all thet other lua files
AddCSLuaFile("cl_init.lua");
AddCSLuaFile("shared.lua");
include("shared.lua");

// Essentials EG Sets Models
function ENT:Initialize()
	self.Entity:SetModel("models/micropro/AncientScreen/ancient_screen.mdl"); // This Sets the model
	self.Entity:SetMaterial("materials/micropro/AncientScreen/screen_red"); // This sets the material for the model
	self.Entity:PhysicsInit(SOLID_VPHYSICS);
	self.Entity:SetMoveType(MOVETYPE_VPHYSICS);
	self.ConsumeAmmount = StarGate.CFG:Get("ancient_screen","energy",500); 
	self.Entity:SetSolid(SOLID_VPHYSICS);
	local phys = self.Entity:GetPhysicsObject();
	if(phys:IsValid()) then
		phys:Wake();
		phys:SetMass(10);
	end

end

// Spawn
function ENT:SpawnFunction(pl, tr)
	if (!tr.HitWorld) then return end;
	local e = ents.Create("ancient_screen"); // What entity it should spawn EG the name of the folder where your lua files are
	e:SetPos(tr.HitPos + Vector(0, 0, 50));
	e:Spawn();
	return e; // You must return e(ENT, depending on coding style) otherwise it will not work
end


// On use

function ENT:Use()

	RunConsoleCommand( "ancient_menu" );
	
end

function Gravity()

	game.ConsoleCommand( "sv_gravity -200" )

end

concommand.Add( "grav_invert", Gravity )
